/**
 * 北京时间转时间戳
 * @returns
 */

function getInervalMinute(startDate, endDate) {
    var ms = endDate.getTime() - startDate.getTime();
    if (ms < 0) return 0;
    return Math.floor(ms/1000/60);
}
function getInervalHour(startDate, endDate) {
    var ms = endDate.getTime() - startDate.getTime();
    if (ms < 0) return 0;
    return Math.floor(ms/1000/60/60);
}
function getInervalDay(startDate, endDate) {
    var ms = endDate.getTime() - startDate.getTime();
    if (ms < 0) return 0;
    return Math.floor(ms/1000/60/60/24);
}
function getInervalMounth(startDate, endDate) {
	var ms = endDate.getTime() - startDate.getTime();
	if (ms < 0) return 0;
	return Math.floor(ms/1000/60/60/24/30);
}
function getInervalYears(startDate, endDate) {
	var ms = endDate.getTime() - startDate.getTime();
	if (ms < 0) return 0;
	return Math.floor(ms/1000/60/60/24/30/12);
}
function getTimeLestNow(time){
	var minutes= getInervalMinute(new Date(time),new Date());
	if(minutes<=60){
		return minutes+"分钟";
	}
	
	var hours=getInervalHour(new Date(time),new Date());
	if(hours<=24){
		return hours+"小时";
	}
	
	var days=getInervalDay(new Date(time),new Date());
	if(days<=30){
		return days+"天";
	}
	
	var mounths=getInervalMounth(new Date(time),new Date());
	if(mounths<=12){
		return mounths+"月";
	}
	var years=getInervalYears(new Date(time),new Date());
		return years+"年";
}
